import request from './request.js'
let userid=''
if(localStorage.getItem('userInfo')==null){
    userid=''
}else{
    userid=JSON.parse(localStorage.getItem('userInfo')).userId
}
// 分享
export function shareWay(param) {
    return request({
      url:'api/blog/share',
      method: 'POST',
      headers: {
        'api-type': 1
      },
      data:param
    })
  }
// 重定向
export function redirectUrl(param) {
    return request({
      url:'api/blog/redirectUrl/'+param.shortLink,
      method: 'GET',
      // headers: {
      //   'api-type': 1
      // },
      // params:param
    })
  }
//获取详情
export function getDetailById(id) {
  return request({
    url:'api/blog/'+id,
    method: 'GET',
    // headers: {
    //   'api-type': 1
    // },
  })
}
//点赞
export function getDz(param) {
  return request({
    url:'api/blog/like',
    method: 'PUT',
    data:param,
    headers: {
      'api-type': 1,
      'userid':userid,
    },
  })
}
//取消点赞
export function cancelDz(param) {
  return request({
    url:'/api/blog/dislike',
    method: 'PUT',
    data:param,
    headers: {
      'api-type': 1,
      'userid':userid,
    },
  })
}
//获取评论列表
export function getPlList(id) {
  return request({
    url:'/api/comment/'+id,
    method: 'GET',
    headers: {
      'api-type': 1,
      'userid':userid,
    },
  })
}
//用户评论
export function PlDetail(params) {
  return request({
    url:'/api/comment',
    method: 'POST',
    data: params,
    headers: {
      'api-type': 1,
      'userid':userid,
    },
  })
}
//删除评论
export function DelPlDetail(params) {
  return request({
    url:'/api/comment/'+params.id,
    method: 'DELETE',
    data: {Id:params.ids},
    headers: {
      'api-type': 1,
      'userid':userid,
    },
  })
}